specify the number of decimals in a dataframe

31

import numpy as np
import pandas as pd 

some_numbers = np.random.ranf(5)

df = pd.DataFrame({'random_numbers':some_numbers})

rounded_df = df.round(decimals=2)

Comments

Submit
0 Comments